home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH13 / 13-2-1.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-11-02  |  4.8 KB  |  171 lines

  1. VERSION 5.00
  2. Begin VB.Form frm13_2_1 
  3.    Caption         =   "Semester Grades"
  4.    ClientHeight    =   4935
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4665
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   4935
  10.    ScaleWidth      =   4665
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.PictureBox picGrades 
  13.       Height          =   1935
  14.       Left            =   120
  15.       ScaleHeight     =   1875
  16.       ScaleWidth      =   4275
  17.       TabIndex        =   14
  18.       Top             =   2880
  19.       Width           =   4332
  20.    End
  21.    Begin VB.Frame fraType 
  22.       Caption         =   "Type of Registration"
  23.       Height          =   735
  24.       Left            =   600
  25.       TabIndex        =   11
  26.       Top             =   1200
  27.       Width           =   3495
  28.       Begin VB.OptionButton optPF 
  29.          Caption         =   "Pass/Fail"
  30.          Height          =   255
  31.          Left            =   1680
  32.          TabIndex        =   13
  33.          Top             =   360
  34.          Width           =   1215
  35.       End
  36.       Begin VB.OptionButton optReg 
  37.          Caption         =   "Regular"
  38.          Height          =   255
  39.          Left            =   360
  40.          TabIndex        =   12
  41.          Top             =   360
  42.          Width           =   1095
  43.       End
  44.    End
  45.    Begin VB.CommandButton cmdQuit 
  46.       Caption         =   "&Quit"
  47.       Height          =   495
  48.       Left            =   3360
  49.       TabIndex        =   10
  50.       Top             =   2160
  51.       Width           =   975
  52.    End
  53.    Begin VB.CommandButton cmdSemGrade 
  54.       Caption         =   "&Calculate Grades"
  55.       Height          =   495
  56.       Left            =   1680
  57.       TabIndex        =   9
  58.       Top             =   2160
  59.       Width           =   1455
  60.    End
  61.    Begin VB.TextBox txtFinal 
  62.       Height          =   285
  63.       Left            =   3600
  64.       TabIndex        =   6
  65.       Top             =   720
  66.       Width           =   375
  67.    End
  68.    Begin VB.TextBox txtMidterm 
  69.       Height          =   285
  70.       Left            =   2520
  71.       TabIndex        =   5
  72.       Top             =   720
  73.       Width           =   375
  74.    End
  75.    Begin VB.TextBox txtSSN 
  76.       Height          =   285
  77.       Left            =   600
  78.       TabIndex        =   3
  79.       Top             =   720
  80.       Width           =   1095
  81.    End
  82.    Begin VB.TextBox txtName 
  83.       Height          =   285
  84.       Left            =   720
  85.       TabIndex        =   1
  86.       Top             =   120
  87.       Width           =   3495
  88.    End
  89.    Begin VB.CommandButton cmdAdd 
  90.       Caption         =   "&Add Student"
  91.       Height          =   495
  92.       Left            =   240
  93.       TabIndex        =   0
  94.       Top             =   2160
  95.       Width           =   1215
  96.    End
  97.    Begin VB.Label lblFinal 
  98.       Caption         =   "Final"
  99.       Height          =   255
  100.       Left            =   3120
  101.       TabIndex        =   8
  102.       Top             =   720
  103.       Width           =   375
  104.    End
  105.    Begin VB.Label lblMidterm 
  106.       Caption         =   "Midterm"
  107.       Height          =   255
  108.       Left            =   1800
  109.       TabIndex        =   7
  110.       Top             =   720
  111.       Width           =   615
  112.    End
  113.    Begin VB.Label lblSSN 
  114.       Caption         =   "SSN"
  115.       Height          =   255
  116.       Left            =   120
  117.       TabIndex        =   4
  118.       Top             =   720
  119.       Width           =   375
  120.    End
  121.    Begin VB.Label lblName 
  122.       Caption         =   "Name"
  123.       Height          =   255
  124.       Left            =   120
  125.       TabIndex        =   2
  126.       Top             =   120
  127.       Width           =   495
  128.    End
  129. Attribute VB_Name = "frm13_2_1"
  130. Attribute VB_GlobalNameSpace = False
  131. Attribute VB_Creatable = False
  132. Attribute VB_PredeclaredId = True
  133. Attribute VB_Exposed = False
  134. 'Form code
  135. Dim section As New Collection
  136. Private Sub cmdAdd_Click()
  137.   Dim pupil As Object
  138.   If optReg.Value Then
  139.       Set pupil = New CSTudent
  140.     Else
  141.       Set pupil = New CPFStudent
  142.   End If
  143.   'Read the Values stored in the Text boxes
  144.   pupil.Name = txtName
  145.   pupil.SocSecNum = txtSSN
  146.   pupil.midGrade = Val(txtMidterm)
  147.   pupil.finGrade = Val(txtFinal)
  148.   section.Add pupil
  149.   'Clear Text Boxes
  150.   txtName.Text = ""
  151.   txtSSN.Text = ""
  152.   txtMidterm.Text = ""
  153.   txtFinal.Text = ""
  154.   picGrades.Print "Student added."
  155. End Sub
  156. Private Sub cmdSemGrade_Click()
  157.   Dim i As Integer, grade As String
  158.   picGrades.Cls
  159.   For i = 1 To section.Count
  160.     picGrades.Print section.Item(i).Name; Tab(28); section.Item(i).SocSecNum(); _
  161.                     Tab(48); section.Item(i).SemGrade
  162.   Next i
  163. End Sub
  164. Private Sub cmdQuit_Click()
  165.   End
  166. End Sub
  167. Private Sub Form_Load()
  168.   'Initially, regular student should be selected
  169.   optReg = True
  170. End Sub
  171.